from entity import User, Child, Parent

user1 = User("admin", 19, "male")
user1.show()
print(User.count)
print(user1.count)

user2 = User("root", 18, "female")
print(user2.getName())  # 私有属性外部访问不到
user2.email = "root@localhost"
print(user2.email)

# 类属性只能通过类来修改
User.count = 100
# 改完之后大家共享改变的值
print(user1.count)
print(user2.count)
# 调用类的方法
User.show2()

User.show3("hello", "world")

# 利用参数默认值实现类似方法重载
user3 = User("admin")
user4 = User("admin", 18)
user5 = User("admin", 18, "male")
user6 = User("admin", 18, "male", "admin@localhost")

# del user6

user2.setName("user2")
print(user2.getName())

print("-----------------------------------------------------------------")

child1 = Child()
child1.show1()
# 父类私有属性或方法不能继承
# print(child1.name)
# child1.show1()
# print(child1.sub_name)





